//牛客HJ73 计算日期到天数的转换
#include <climits>
#include <iostream>
#include <istream>
#include <limits>
#include <ostream>
using namespace std;


class Date
{
public:
    Date(int year=1,int month=1,int day=1)
    {
        _year=year;
        _month=month;
        _day=day;
    }
    int GetMonthday(int& year,int& month)
    {
        int arr[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
        if(month==2&&((year%4==0&&year%100!=0)||year%400==0))
        {
            return 29;
        }
        else
        {
            return arr[month];
        }

    }
    friend ostream& operator<<(ostream& out,Date& d);
    friend istream& operator>>(istream& out,Date& d);
private:
    int _year;
    int _month;
    int _day;
};

ostream& operator<<(ostream& out,Date& d)
{
    int sum=d._day;
    --d._month;
    while(d._month>0)
    {
        sum+=d.GetMonthday(d._year,d._month);
        --d._month;
    }
    out<<sum<<endl;
    return out;
}
istream& operator>>(istream& in,Date& d)
{
    in>>d._year>>d._month>>d._day;
    return in;
}
int main()
{
    Date d1;
    cin>>d1;
    cout<<d1<<endl;
}